#ifndef _CMD_H
#define _CMD_H

#include "nlist.h"
#include "stdtypes.h"

#define CMD_NOT_FOUND_MSG "cli cmd not found\0"
#define CMD_NOT_FOUND_LEN 18

typedef void * (*CMD_FUNC)(int argc, char **argv, int *ret_len);

typedef struct {
    nlist_node_t list;
    u8 *cmd_name;
    CMD_FUNC func;
    u8 *help_info;
} cli_cmd_list;

void cli_cmd_list_init(cli_cmd_list *l);
void register_cmd_func(char *cmd_name, CMD_FUNC func, char *help_info);
void * exec_cmd_func(char *cmd_content, int length, int *ret_len);

#endif